package com.hruiworks.campusgroup.manager.entity;

import com.hruiworks.campusgroup.pojo.entity.Activity;
import com.hruiworks.campusgroup.pojo.entity.Group;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

@Data
public class GroupFullInfo implements Serializable {

    @Serial
    private static final long serialVersionUID = 8477947278151962114L;

    /**
     * 团队
     */
    private Group group;

    /**
     * 活动
     */
    private Activity activity;

    /**
     * 团队情况，2表示待开始，3表示进行中，4表示已结束
     */
    private Integer groupTime;

    public GroupFullInfo() {
    }

    public GroupFullInfo(Group group, Activity activity) {
        this.group = group;
        this.activity = activity;
        if (group.getStartTime().isAfter(LocalDateTime.now())) {
            this.groupTime = 2;
        } else if (group.getStartTime().isBefore(LocalDateTime.now()) && group.getEndTime().isAfter(LocalDateTime.now())) {
            this.groupTime = 3;
        } else {
            this.groupTime = 4;
        }
    }
}
